package com.dq.controller.op.opboss.org;

import com.dq.exception.customException.AdminException;
import com.dq.controller.in.OrgPositionQuery;
import com.dq.vo.Vo;
import com.dq.domain.org.centre.OrgDeptPositionCentre;
import com.dq.service.AllService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @Author luchangtong
 * @Date 2020/1/6 16:03
 */
@Api(description = "门店设置岗位")
@RestController
@RequestMapping("sys/boss/OrgDeptPositionCentre/")
public class OrgDeptPositionCentreController extends AllService {

    @ApiOperation("列表")
    @PostMapping("list")
    public Vo list(@RequestBody OrgPositionQuery orgPositionQuery)throws AdminException{
        return orgDeptPositionCentreService.list(orgPositionQuery);
    }

    @ApiOperation("添加")
    @PostMapping("add/{orgPositionId}")
    public Vo add(@PathVariable Long orgPositionId,@RequestBody OrgDeptPositionCentre orgDeptPositionCentre) throws AdminException{
        return orgDeptPositionCentreService.add(orgPositionId,orgDeptPositionCentre);
    }

    @ApiOperation("编辑")
    @PostMapping("edit/{id}/{orgPositionId}")
    public Vo edit(@PathVariable Long id,@PathVariable Long orgPositionId,@RequestBody OrgDeptPositionCentre orgDeptPositionCentreEdit) throws AdminException {

        return orgDeptPositionCentreService.edit(id, orgPositionId, orgDeptPositionCentreEdit);
    }

    @ApiOperation("删除")
    @PostMapping("delete/{id}")
    public Vo delete(@PathVariable Long id)throws AdminException{

        return orgDeptPositionCentreService.delete(id);
    }

    @ApiOperation("查看所有岗位")
    @GetMapping("findAllPosition")
    public Vo findAllPosition()throws AdminException{
        return communalService.findAllPosition();
    }
}
